jQuery(function(){
	jQuery.noConflict();
	jQuery.ajax({
		url:server_url+"/rest/sellerOrder/shipmentData.do",
		type:"post",
		data:{
			orderid:params()["orderid"],
			userid:userid
		},
		success:function(data){
			//console.log(data);
			jQuery("#shiper").text("姓名："+data.data.seller.supplyName);
			jQuery("#shiperMobile").text("电话："+data.data.seller.userMobile);
			jQuery("#shiperAddr").text(data.data.seller.province+data.data.seller.city+data.data.seller.county);
			
			jQuery("#consignee").text("姓名："+data.data.order.consignee);
			jQuery("#consMobile").text("电话："+data.data.order.consMobile);
			jQuery("#consAddr").text(data.data.order.consAddr);
		},
		error:function(){
			easyAlert("出错啦");
		}
	});
});
function shipment(){
	var realCarrier = jQuery("#realCarrier").val();
	var carrierMobile = jQuery("#carrierMobile").val();
	var carrierCarNo = jQuery("#carrierCarNo").val();
	//var shipBillCode = jQuery("#shipBillCode").val();
	
	/*if(empty(shipBillCode)){
		easyAlert("请填写运单号");
		return;
	}*/
	if(empty(realCarrier)){
		easyAlert("请填写送货员姓名");
		return;
	}else{
		if(empty(carrierMobile)){
			easyAlert("请填写送货员手机号");
			return;
		}else{
			if(!isPhone(carrierMobile)){
				easyAlert("请输入有效的手机号.");
				return;
			}else{
				if(empty(carrierCarNo)){
					easyAlert("请填写送货员车牌号");
					return;
				}
			}
		}
	}
	jQuery.ajax({
		url:server_url+"/rest/sellerOrder/shipment.do",
		data:{userid:userid,orderid:params()["orderid"],realCarrier:realCarrier,carrierMobile:carrierMobile,
			carrierCarNo:carrierCarNo},
		type:"post",
		success:function(data){
			easyAlert("发货成功");
			window.location.href=server_url+"index.do";
		}
	});
}
function toOrderList(){
	localStorage.setItem("orderList",1);
	window.location.href=server_url+"index.do?ran="+Math.random();
};
function isPhone(userNumb){//验证手机号码
	var reg = /^[1][34578][0-9]{9}$/;
	return reg.test(userNumb);
};